package com.dlc.felear.xiaoensale.broadcastreceiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.dlc.felear.xiaoensale.activity.FirstActivity;

/**
 * Created by apple on 2018/1/23.
 */

public class AutoStartBroadcastReceiver extends BroadcastReceiver {
    static final String action_boot = "android.intent.action.BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent) {

        if (TextUtils.equals(intent.getAction(), Intent.ACTION_BOOT_COMPLETED) ||
                TextUtils.equals(intent.getAction(), Intent.ACTION_PACKAGE_REPLACED)) {
            //启动activity
//            start(context);
        }
    }

    private void start(Context context) {
        Intent sayHelloIntent = new Intent(context, FirstActivity.class);
        sayHelloIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(sayHelloIntent);
    }
}
